package com.julius.design.pattern.factory.ab;

import com.julius.design.pattern.factory.normal.UserPrototype;
import java.util.Objects;

/**
 * <p>
 *      订单工厂类
 * </p>
 * @author 117028
 */
public class OrderFactory extends AbstractFactory{
    @Override
    public UserPrototype getUserObjectByName(String userObjectName) {
        return null;
    }

    @Override
    public Order getOrderObjectByName(String orderObjectName) {
        if (Objects.isNull(orderObjectName)) {
            return null;
        }

        if ("b".equalsIgnoreCase(orderObjectName)) {
            return new OrderOfB();
        }
        if ("c".equalsIgnoreCase(orderObjectName)) {
            return new OrderOfC();
        }

        return null;
    }
}
